﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ecdl.demo.persistence;
using System.Xml.Serialization;
namespace ecdl.demo.model {
    public class TestDTO : DTO<Test>{
        [XmlAttribute("name")]
        public string Name { get; set; }

        public TestDTO() {
            Tasks = new List<TaskDTO>();
        }

        public List<TaskDTO> Tasks { get; set; }
        
        public override Test ToModel(ModelFactory factory) {
            Test test = factory.CreateModel<Test>();
            test.Name = Name;
            foreach (var task in Tasks) {
                test.Tasks.Add(task.ToModel(factory));
            }
            return test;
        }
    }
}
